﻿package Chapter06;
import java.util.ArrayList;


public class DotComTestDrive {
	void test () {
		// SetLocation
		DotCom company = new DotCom();
		ArrayList<String> loc = new ArrayList<String>();
		loc.add("A4");
		loc.add("A5");
		loc.add("A6");
		company.setLocationCells(loc);
		
		// checkYourself
		// 預期的正確答案
		//String [] result = {"miss","miss","miss","miss","hit","hit","kill","miss"};
		ArrayList<String> result = new ArrayList<String>();
		for (int i = 0; i < result.size(); i++) {
			if (i==4 || i==5) {
				result.add("hit");
			} else if (i == 6) {
				result.add("kill");
			} else {
				result.add("miss");
			}
		}
		// 全部正確
		boolean correct_answered = true; 
		for (int i = 0; i < 7; i++) {
			if (company.checkYourself("A"+i) != result.get(i)) {
				correct_answered = false;
			}
		}
		String output = correct_answered ? "passed" : "error";
		System.out.println(output);
	}
}
